﻿using System;

using ServicesComponent.Repositories;
using System.Web.Services;

public partial class DanhMucChung_NienKhoaList : System.Web.UI.Page
{
    public    int id = 1;
    private static ISchoolYearRepository _SchoolYearRepository;
    protected void Page_Load(object sender, EventArgs e)
    {
        id = id + 1;

        if (!IsPostBack)
        {
            if (Request.QueryString["Refresh"] != null)
            {
                _SchoolYearRepository = FactoryServices.GetServicesSchoolYear(_SchoolYearRepository);
                Bind();
                return;
            }
            if (Request.QueryString["Page"] != null )
            {
                id = (int.Parse(Request.QueryString["Page"].ToString()) -1)*14 +1;
            }
        }   
            _SchoolYearRepository = FactoryServices.GetServicesSchoolYear(_SchoolYearRepository);
            Bind();
          
    }
    //Delete Recall 
     void Bind()
     {
         rptA.Dispose();
        // rptA.RenderControl("f");
         rptA.DataSource = null;
      //   rptA.BeginResetItemTemplate();
         rptA.DataSource = _SchoolYearRepository.GetSchoolYearBySchoolId(int.Parse(Session["SchoolID"].ToString()));

        rptA.DataBind();
        Cpage.DataSource = _SchoolYearRepository.GetSchoolYearBySchoolId(int.Parse(Session["SchoolID"].ToString()));
        Cpage.BindToControl = rptA;
        rptA.DataSource = Cpage.DataSourcePaged;
        // drAddress.EndResetItemTemplate()

    }
     protected void Button1_Click(object sender, EventArgs e)
     {
         Bind();
     }
}